package com.aries.ui.widget.demo.module.tab;

import com.aries.ui.widget.demo.ResourceTable;
import ohos.agp.components.*;
import ohos.agp.utils.LayoutAlignment;
import ohos.agp.utils.TextAlignment;
import ohos.app.Context;


/**
 * @Author: AriesHoo on 2019/4/16 17:48
 * @E-Mail: AriesHoo@126.com
 * @Function: Fragment 示例
 * @Description:
 */
public class SimpleCardFragment extends DependentLayout {
    private String mTitle;
    private Text text;

    public String getmTitle() {
        return mTitle;
    }

    public SimpleCardFragment(Context context) {
        this(context,null);
    }

    public SimpleCardFragment(Context context, AttrSet attrSet) {
        super(context, attrSet);
        //1. 创建Text对象
        text = new Text(context);
//2. 设置文本内容宽高
        text.setWidth(ComponentContainer.LayoutConfig.MATCH_PARENT);
        text.setHeight(ComponentContainer.LayoutConfig.MATCH_PARENT);
//4. 设置文字大小
        text.setTextSize(18, Text.TextSizeType.FP);
//6. 添加组件到布局中
        text.setTextAlignment(TextAlignment.CENTER);
        setAlignment(LayoutAlignment.CENTER);
        addComponent(text);

    }

    public void setTitle(String mTitle) {
        this.mTitle = mTitle;
        text.setText(mTitle);
    }
}